//
//  ZLW_VideoModel.m
//  Otaku
//
//  Created by lanou3g on 16/5/12.
//  Copyright © 2016年 Liuwx. All rights reserved.
//

#import "ZLW_VideoModel.h"

@implementation ZLW_VideoModel
-(void)setValue:(id)value forKey:(NSString *)key
{
    [super setValue:value forKey:key];
    if ([key isEqualToString:@"id"]) {
        self.ID = value;
    }
    
}
-(CGFloat)cellHeight
{
    CGSize maxSize = CGSizeMake([UIScreen mainScreen].bounds.size.width - 2 * 10, MAXFLOAT);
    CGFloat textHeight = [self.text boundingRectWithSize:maxSize options:NSStringDrawingUsesLineFragmentOrigin attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:17]} context:nil].size.height;
    _cellHeight = 150 + textHeight;
    
    
    //videoImageview的高度
    CGFloat videoX = 0;
    CGFloat videoY = 100 + textHeight;
    CGFloat videoWidth = [UIScreen mainScreen].bounds.size.width - 20;
    
    CGFloat h = self.video_height;
    CGFloat w = self.video_width;
    
    CGFloat videoHeight = h * videoWidth / w;
    
    if (h == 0 || w == 0) {
        videoHeight = 0;
    }
    
    self.videoFrame = CGRectMake(videoX, videoY, videoWidth, videoHeight);
    _cellHeight += videoHeight - 100;
    return _cellHeight;
}


@end
